<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="/WEB-INF/yy-1_0.tld" prefix="yy"%>
<yy:footprint pageTitle="${pageTitleLocal}" />
<html>
<head>
	<base href="${AppURL}/ilib/" />
  	<title>标签云--资源详细信息</title>
	<link rel=stylesheet type=text/css href="style/main.css">
	<link rel=stylesheet type=text/css href="CSS/tagInfoStyle.css">

	<script type="text/javascript">
		function checkTag(){
			var tags=document.getElementById("tagName").value;
			var rating=document.getElementById("rating").value;
			var readStatus=document.getElementById("readStatus").value;
			if("0" == rating){
				alert("请给出您的评分。");
				return false;
			}else if("0" == readStatus){
				alert("请更新您的阅读状态。");
				return false;
			}else if(""==tags){
				alert("标签名称不能为空。");
				return false;
			}else{
				document.forms[0].submit();
			}
		}	
	</script>
</head>

<body>
<div id="container">
<div id="wrapper">
	<%@ include file="../share/header.jsp" %>
	<div id="option">
		你好，${username }!
	</div>
	<div id="clear"></div> 
	
	<!-- title div -->
	<h1 align="center"><c:out value="${rsc.rscKeyWord}"/></h1>
	<h4 align="right"><span>
		<span><strong>作者</strong></span>：
    	<c:forEach items="${authorList}" var="author" >
			<a href="http://localhost:4180/ilib/getResearcherInfo.do?researcherId=<c:out value="${author.uid}"/>" id="author"><c:out value="${author.name}"/></a>
		</c:forEach>
	</span>
	</h4>
	
	<div id="content">
	
		<!-- info div -->
     	<div id="info">
     	
  		<div>
  		<br/><br/>
  		<table align="center" width="800">
     	<tbody align="center" >
     	
     	<tr>
  				<td><span><strong>类型</strong></span>：<c:out value="${rsc.type}"/></td>
  				<td><span><strong>来源域</strong></span>：<c:out value="${rsc.field}"/></td>
  				<td><span><strong>综合评分</strong></span>：
  				<span class="rate" >
    					<strong><c:out value="${lastTagSys.averScore}"/></strong>
   				</span>
				</td>
				<td>
  				<span><strong>下载</strong></span>：
  				<c:choose>
  					<c:when test="${empty rsc.rscUrl}">暂无资源</c:when>
  					<c:when test="${rsc.rscUrl eq '-1'}">暂无资源</c:when>
  					<c:otherwise>
  						<a href= "${rsc.rscUrl}&username=${username}&resourceId=${rsc.rscId}&type=ilib'" />下载链接</a><br>
  					</c:otherwise>
  				</c:choose>
  				</td>
  		</tr>
  		
  				</tbody>
  			</table>
  			<br/>
  			</div>
  			
     	</div>

		<div>
	    	<div>
	    		<div class ="mainbox">
			    	<br/>
					<hr color="#DDDDDD"/>
					<br/>
			    	<h2>摘要 &nbsp; ·&nbsp;·&nbsp;·&nbsp;·&nbsp;·&nbsp;·&nbsp; </h2>
		    		<div>&nbsp;&nbsp;&nbsp;&nbsp;<c:out value="${rsc.rscSummary}"/><br></div>
		    		<br/>
					<hr color="#DDDDDD"/>
					<br/>
					<div>
						<h2>其他成员常用的标签 &nbsp; ·&nbsp;·&nbsp;·&nbsp;·&nbsp;·&nbsp;·&nbsp;</h2>
						<div>
							<c:if test="${listSize > 0}">
							&nbsp;&nbsp;&nbsp;&nbsp;
								<c:forEach items="${tagNames}" var="tagName" varStatus="name" >
									<c:out value="${tagName}"/>&nbsp;·&nbsp;
								</c:forEach>
							</c:if>
						</div>
					</div>
					<br/>
					<hr color="#DDDDDD"/>
					<br/>
				</div>
				
				<div class="mainbox">
	 				<h2 class="cleft">用户评论&nbsp;&nbsp;· · · · · ·&nbsp;</h2>
	
					<!-- 分页区 -->
		    		<div class="msdn">
			    		<c:choose>
			    				<c:when test="${currentPageNo > 1}">
			    					<a href="../rscInfo.do?rscId=${rsc.rscId}&pageNo=${currentPageNo-1}">&lt;  上一页</a>
								</c:when>
			    				<c:otherwise>
			    					<span class="current">&lt;  上一页</span>
			    				</c:otherwise>
			    		</c:choose>
			    		<c:forEach var="pageNo" begin="1" end="${countPages}" step="1">
			    			<c:choose>
			    				<c:when test="${currentPageNo eq pageNo}"><span class="current">${pageNo}</span></c:when>
			    				<c:otherwise>
			    					<a href="../rscInfo.do?rscId=${rsc.rscId}&pageNo=${pageNo}">${pageNo}</a>
			    				</c:otherwise>
			    			</c:choose> 
			 			</c:forEach>  
			    		<c:choose>
			    				<c:when test="${currentPageNo < countPages}">
			    					<a href="../rscInfo.do?rscId=${rsc.rscId}&pageNo=${currentPageNo+1}">下一页  &gt; </a>
								</c:when>
			    				<c:otherwise>
			    					<span class="current">下一页  &gt;</span>
			    				</c:otherwise>
			    		</c:choose>
		    		</div>
	    		
	        		<br/>
			       	<div>
			       		<c:choose>
				        	<c:when test="${listSize > 0}">
				        	<c:forEach items="${list}" var="tag" end="10">
				        		<div class="infocomment">
	        					<dl>
									<dd><h3><strong>${tag.tagUser}</strong>&nbsp;&nbsp;&nbsp;&nbsp;发表于：${tag.time}</h3></dd><dd class="user_rate">评分：${tag.rscScore}</dd>
									<dd>${tag.comments}</dd>
								</dl>
	        				</div>
				    		</c:forEach>
				    		</c:when>
				    		<c:otherwise>
				    			<h2>暂无任何评论</h2>
				    		</c:otherwise>
	    				</c:choose>
		   			</div>
		   			
				    <br/>
				    <br/>
				    
		   			<!-- 分页区 -->
		    		<div class="msdn">
			    		<c:choose>
			    				<c:when test="${currentPageNo > 1}">
			    					<a href="../rscInfo.do?rscId=${rsc.rscId}&pageNo=${currentPageNo-1}">&lt;  上一页</a>
								</c:when>
			    				<c:otherwise>
			    					<span class="current">&lt;  上一页</span>
			    				</c:otherwise>
			    		</c:choose>
			    		<c:forEach var="pageNo" begin="1" end="${countPages}" step="1">
			    			<c:choose>
			    				<c:when test="${currentPageNo eq pageNo}"><span class="current">${pageNo}</span></c:when>
			    				<c:otherwise>
			    					<a href="../rscInfo.do?rscId=${rsc.rscId}&pageNo=${pageNo}">${pageNo}</a>
			    				</c:otherwise>
			    			</c:choose> 
			 			</c:forEach>  
			    		<c:choose>
			    				<c:when test="${currentPageNo < countPages}">
			    					<a href="../rscInfo.do?rscId=${rsc.rscId}&pageNo=${currentPageNo+1}">下一页  &gt; </a>
								</c:when>
			    				<c:otherwise>
			    					<span class="current">下一页   &gt;</span>
			    				</c:otherwise>
			    		</c:choose>
		    		</div>
		    		
		    		<br/>
					<hr color="#DDDDDD"/>
					<br/>
		    		
    			</div>
    		
			</div>
			
			<div class="mainbox">
			<h2 class="cleft">我来评论&nbsp;&nbsp;· · · · · ·&nbsp;</h2>
				<form action="../saveTagInfo.do" method="post" onsubmit="">
					<table align="center">
					<tbody>
					    <tr>
					        <td>
					        	<textarea style="width:800px;height:100px" name="comment" id="comment">${lastTagSys.comments}</textarea>
					        </td>
					    </tr>
					    <tr>
					    	<td align="left" height="35">评&nbsp;&nbsp;分：
								<input type="hidden" name="rscId" id="rscId" value="${rsc.rscId}"/>
							<select name="rating" id="rating" >
								<c:choose>
									<c:when test="${empty lastTagSys.rscScore}">
										<option value="0" selected="selected">---选择分数---</option>
										<option value="1" id="1">1</option>
										<option value="2" id="2">2</option>
										<option value="3" id="3">3</option>
										<option value="4" id="4">4</option>
										<option value="5" id="5">5</option>
										<option value="6" id="6">6</option>
										<option value="7" id="7">7</option>
										<option value="8" id="8">8</option>
										<option value="9" id="5">9</option>
										<option value="10" id="5">10</option>
									</c:when>
									<c:otherwise>
										<c:forEach var="i" begin="1" end="10" step="1">
											<c:choose>
											<c:when test="${i eq lastTagSys.rscScore}">
												<option id="${i}" value="${i}" selected="selected">${i}</option>
											</c:when>
											<c:otherwise>
												<option id="${i}" value="${i}">${i}</option>
											</c:otherwise>
											</c:choose>
										</c:forEach>
									</c:otherwise>
								</c:choose>
							</select>&nbsp;&nbsp;&nbsp;&nbsp;
					    	<span>阅读状态：&nbsp;&nbsp;&nbsp;&nbsp;</span>
								<select name="readStatus" id="readStatus">
									<c:choose>
										<c:when test="${empty lastTagSys.readStatus}">
											<option value="0" selected="selected">---阅读状态---</option>
											<option value="1">在读</option>
											<option value="2">已读</option>
											<option value="3">要读</option>
										</c:when>
										<c:otherwise>
											<c:forEach var="i" begin="1" end="3" step="1">
												<c:choose>
												<c:when test="${i eq lastTagSys.readStatus}">
													<option value="${i}" selected="selected">
														<c:choose>
															<c:when test="${i eq 1}">在读</c:when>
															<c:when test="${i eq 2}">已读</c:when>
															<c:when test="${i eq 3}">要读</c:when>
														</c:choose>
													</option>
												</c:when>
												<c:otherwise>
													<option value="${i}">
														<c:choose>
															<c:when test="${i eq 1}">在读</c:when>
															<c:when test="${i eq 2}">已读</c:when>
															<c:when test="${i eq 3}">要读</c:when>
														</c:choose>
													</option>
												</c:otherwise>
												</c:choose>
											</c:forEach>
										</c:otherwise>
									</c:choose>
								</select>
							</td>
						</tr>
					    <tr>
							<td align="left" height="35">标&nbsp;&nbsp;签：
								<input type="text" name="tags" id="tagName" value="${lastTagSys.tagName}"/>&nbsp;&nbsp;注 : 多个标签用空格隔开
								<input type="hidden" name="rscType" value="typeRsc"/>
							</td>
						</tr>
					    
					    <tr>
					    	<td><br><input name="rev_submit" type="button" value="好了，添加评论"  onclick="checkTag()"></td>
					    </tr>
					</tbody>
					</table>
				</form>
				
				<br/>
					<hr color="#DDDDDD"/>
				<br/>
				
    		</div>

		</div>
	</div>
</div>
	
<div id="footer">iLib 2010</div>
<!-- end # container -->
<br/>
</div>
</body>
</html>